﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EverBuy.SocialNetworking.Data.Repository.Abstract.Factory;

namespace EverBuy.SocialNetworking.Data.DataFactory
{
    /// <summary>
    /// 
    /// </summary>
    public class DataFactoryCreator
    {
        #region constants
        /// <summary>
        /// 
        /// </summary>
        public const string AdoDotNetAccess = "ADO.NET.Access";

        /// <summary>
        /// 
        /// </summary>
        public const string AdoDotNetOracle = "ADO.NET.Oracle";

        /// <summary>
        /// 
        /// </summary>
        public const string AdoDotNetSqlExpress = "ADO.NET.SqlExpress";

        /// <summary>
        /// 
        /// </summary>
        public const string AdoDotNetSqlServer = "ADO.NET.SqlServer";

        /// <summary>
        /// 
        /// </summary>
        public const string EntityFrameworkSqlExpress = "EntityFramework.SqlExpress";

        /// <summary>
        /// 
        /// </summary>
        public const string EntityFrameworkSqlServer = "EntityFramework.SqlServer";

        #endregion

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataProvider"></param>
        /// <returns></returns>
        public static IDataFactory GetFactory(string dataProvider)
        {
            //return the requested IDataFactory
            switch (dataProvider)
            {
                case AdoDotNetAccess: return new EverBuy.SocialNetworking.Data.ADODotNetAccessRepository.Factory.DataFactory();
                case AdoDotNetOracle: return new EverBuy.SocialNetworking.Data.ADODotNetOracleRepository.Factory.DataFactory();
                case AdoDotNetSqlExpress:
                case AdoDotNetSqlServer: return new EverBuy.SocialNetworking.Data.ADODotNetSqlServerRepository.Factory.DataFactory();
                case EntityFrameworkSqlExpress:
                case EntityFrameworkSqlServer: return new EverBuy.SocialNetworking.Data.EntityFrameworkRepository.Factory.DataFactory();

                //default: SqlExpress
                default: return new EverBuy.SocialNetworking.Data.EntityFrameworkRepository.Factory.DataFactory();
            }
        }
    }
}
